import {HTTP} from "../utils/http-p";
import {getToken} from '../utils/localstorg'

class LoginModel extends HTTP{
  login(user,pwd){
    return this.request({
      url:"/user/login",
      data:{user,pwd},
      method:"post"
    })
  }
  register(user,username,pwd,desc){
    return this.request({
      url:"/user/register",
      data:{user,username,pwd,desc},
      method:"post"
    })
  }

  loginTest(){
    const token=getToken()
    if(!token){
      return false
    }
    return this.request({
      url:'/user/get-user',
      data:{token},
      method:"post"
    })
  }
}

export {LoginModel}
